package nz.co.doherty.gwtpbreadcrumbs.client.ui.customers;

import nz.co.doherty.gwtpbreadcrumbs.client.i8n.ClientConstants;
import nz.co.doherty.gwtpbreadcrumbs.client.ui.common.ListViewImpl;
import nz.co.doherty.gwtpbreadcrumbs.shared.entity.Customer;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.Constants;
import com.google.gwt.user.client.ui.Button;
import com.google.inject.Inject;
import com.google.inject.Provider;

public class CustomerListViewImpl extends
		ListViewImpl<Customer, CustomerListView.Presenter> implements
		CustomerListView {
	
	@Inject
	public CustomerListViewImpl(Provider<CustomerListView.Presenter> presenterProvider, ClientConstants constants) {
		super(presenterProvider, constants);
	}

	@Override
	public Button[] getButtons() {
		Button[] buttons = new Button[1];
		buttons[0] = new Button(constants.createCustomer(), new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				getPresenter().onCreate();
			}
		});
		return buttons;
	}

}
